/*
package com.hsmw.api.controller.driver;

import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hsmw.api.config.jwt.CurrentHsmwUserUtils;
import com.hsmw.api.controller.pub.IDCardVerificationUtils;
import com.hsmw.api.service.*;
import com.hsmw.api.vo.*;
import com.hsmw.common.base.BaseController;
import com.htn.common.core.base.DataResponse;
import com.htn.common.core.constant.CommonConstants;
import com.htn.common.core.constant.OrderStatusEnum;
import com.htn.common.core.utils.StringUtils;
import com.hsmw.domain.*;
import com.hsmw.domain.vo.OrderQueryVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.DelayQueue;

@Api(tags = "司机端小程序版相关接口表")
@RestController
@RequestMapping(value = "/api/driver")
public class HsmwDriverController extends BaseController<HsmwDriverService, HsmwUserDriver> {



	@Autowired
	private CurrentHsmwUserUtils currentHsmwUserUtils;

	@Autowired
	private HsmwItemService hsmwItemService;


	@Autowired
	private HsmwOrderService hsmwOrderService;


	@Autowired
	private HsmwOrderVehicleRelationService hsmwOrderVehicleRelationService;


	@Autowired
	private HsmwOrderForceManRelationService hsmwOrderForceManRelationService;


	@Autowired
	private HsmwUserDriverService hsmwUserDriverService;


	@Autowired
	private HsmwAuditService hsmwAuditService;


	@Autowired
	private HsmwDriverNewsService hsmwDriverNewsService;



*
	 * 司机信息认证
	 *
	 * @param
	 * @return


	@ApiOperation(value = "身份信息认证", notes = "身份信息认证", produces = "application/json")
	@PostMapping("/idCardAnthentic")
	public DataResponse idCardAnthentic(@RequestBody IDCardVericationVO vo) {
		try {
			LoginUser hsmwUser = currentHsmwUserUtils.getCurrentUserInfo();

			if (StringUtils.isBlank(vo.getIDCard())) {
				return new DataResponse(CommonConstants.ResponseStatus.VALIDATE_FAILED, "您输入的身份证号为空，请重新输入！");
			}
			if (StringUtils.isBlank(vo.getName())) {
				return new DataResponse(CommonConstants.ResponseStatus.VALIDATE_FAILED, "您输入的姓名为空，请重新输入！");
			}
			//hsmwAuditService.saveOrUpdateHsmwAudit(hsmwAudit);
			IDCardVericationVO vo1 = IDCardVerificationUtils.iDCardVerification(vo);
			if ("0".equals(vo1.getCode())) {
				LambdaQueryWrapper<HsmwAudit> lambdaQueryWrapper = new LambdaQueryWrapper<>();
				lambdaQueryWrapper.eq(HsmwAudit::getUserId, hsmwUser.getId());
				List<HsmwAudit> list = hsmwAuditService.list(lambdaQueryWrapper);
				HsmwAudit audit = new HsmwAudit();
				if (StringUtils.isListNotNull(list)) {
					audit = list.get(0);
					audit.setIdCardFront(vo.getIdCardFront());
					audit.setIdCardFrontId(vo.getIdCardFrontId());
					audit.setIdCardBack(vo.getIdCardBack());
					audit.setIdCardBackId(vo.getIdCardBackId());
					audit.setIdCard(vo.getIDCard());
					audit.setName(vo.getName());
					audit.setUsername(hsmwUser.getUsername());
					audit.setUserId(hsmwUser.getId());
					audit.setAuditTime(null);
					//audit.setAuditStatus("审核中");
					hsmwAuditService.updateById(audit);
				} else {
					audit.setIdCardFront(vo.getIdCardFront());
					audit.setIdCardFrontId(vo.getIdCardFrontId());
					audit.setIdCardBack(vo.getIdCardBack());
					audit.setIdCardBackId(vo.getIdCardBackId());
					audit.setIdCard(vo.getIDCard());
					audit.setName(vo.getName());
					audit.setUsername(hsmwUser.getUsername());
					audit.setUserId(hsmwUser.getId());
					audit.setAuditTime(null);
					//audit.setAuditStatus("审核中");
					hsmwAuditService.save(audit);
				}
				IDCardVericationVO vos = new IDCardVericationVO();
				vos.setIDCard(vo.getIDCard());
				vos.setName(vo.getName());
				return new DataResponse(vos);
			} else {
				return new DataResponse(vo1);
			}
		} catch (Exception e) {
			e.printStackTrace();
			return new DataResponse(CommonConstants.ResponseStatus.SYSTEM_ERROR, "司机认证信息新增或修改异常，请联系系统管理员！");
		}
	}


*
	 * 司机信息认证
	 *
	 * @param
	 * @return


	@ApiOperation(value = "司机信息认证", notes = "司机信息认证", produces = "application/json")
	@PostMapping("/driverInfoAnthentic")
	public DataResponse driverInfoAnthentic(@RequestBody HsmwAudit hsmwAudit) {
		try {
			LoginUser hsmwUser = currentHsmwUserUtils.getCurrentUserInfo();
			LambdaQueryWrapper<HsmwAudit> lambdaQueryWrapper = new LambdaQueryWrapper<>();
			lambdaQueryWrapper.eq(HsmwAudit::getUserId, hsmwUser.getId());
			List<HsmwAudit> list = hsmwAuditService.list(lambdaQueryWrapper);
			HsmwAudit audit = new HsmwAudit();
			if (StringUtils.isListNotNull(list)) {
				audit = list.get(0);
				hsmwAudit.setId(audit.getId());
			}
			hsmwAudit.setAuditStatus("审核中");
			hsmwAudit.setUserId(hsmwUser.getId());
			hsmwAudit.setAuditTime(null);
			hsmwAuditService.saveOrUpdateHsmwAudit(hsmwAudit);
			HashMap result = new HashMap();
			result.put("auditStatus", "审核中");
			return new DataResponse(result);
		} catch (Exception e) {
			e.printStackTrace();
			return new DataResponse(CommonConstants.ResponseStatus.SYSTEM_ERROR, "司机身份证信息校验异常，请联系系统管理员！");
		}
	}

*
	 * 查询司机端的进行中的订单
	 *
	 * @param
	 * @return


	@ApiOperation(value = "查询司机端的进行中的订单", notes = "查询司机端的进行中的订单", produces = "application/json")
	@PostMapping("/getGoingOrders")
	public DataResponse getGoingOrders() {
		try {
			LoginUser hsmwUser = currentHsmwUserUtils.getCurrentUserInfo();
			//获取工长所在项目的项目名称和项目id。
			HashMap result = new HashMap();
			HashMap param = new HashMap();
			LambdaQueryWrapper<HsmwOrderVehicleRelation> lambdaQueryWrapper = new LambdaQueryWrapper();
			List<String> statusParam = new ArrayList<>();
			//param.put("status",OrderStatusEnum.GOING.getValue());

			param.put("userId", hsmwUser.getId());
			List<DriverOrderInfoVO> orderList = hsmwOrderVehicleRelationService.getGoingOrderListByParam(param);
			result.put("orderList", orderList);
			//查询司机的状态 是 接单中 还是 休息中
			LambdaQueryWrapper<HsmwUserDriver> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
			lambdaQueryWrapper1.eq(HsmwUserDriver::getUserId, hsmwUser.getId());
			HsmwUserDriver hsmwUserDriver = hsmwUserDriverService.getOne(lambdaQueryWrapper1);
			String status = "";
			if(StringUtils.isNull(hsmwUserDriver)){
				status =CommonConstants.DRIVER_FREE;
			}else if(StringUtils.isBlank(hsmwUserDriver.getWorkStatus())) {
				status =CommonConstants.DRIVER_FREE;
			}else{
				status =hsmwUserDriver.getWorkStatus();
			}
			result.put("workStatus", status);
			//查询 方量统计
			return new DataResponse(result);
		} catch (Exception e) {
			e.printStackTrace();
			return new DataResponse(CommonConstants.ResponseStatus.FAIL, "获取订单列表失败，请联系管理员！");
		}
	}


*
	 * 查询系统消息
	 *
	 * @param
	 * @return


	@ApiOperation(value = "查询系统消息", notes = "查询系统消息", produces = "application/json")
	@PostMapping("/getSystemMsg")
	public DataResponse getSystemMsg() {
		try {
			LoginUser hsmwUser = currentHsmwUserUtils.getCurrentUserInfo();

			HashMap result = new HashMap();
			List<SystemMsgVO> msgList = new ArrayList<>();
   msgList.add(new SystemMsgVO("2021-02-12 12:21:12","您有新的订单待接收，请到接单大厅尽快接收！"));
            msgList.add(new SystemMsgVO("2021-02-11 12:21:12","接单成功，请于2020-12-25 15:59:54前赶到目\n" +
                    "的地并进行打卡！"));
            msgList.add(new SystemMsgVO("2021-02-12 12:10:12","订单即将开始，请尽快赶往施工地点并打卡开始！"));

			LambdaQueryWrapper<HsmwDriverNews> lambdaQueryWrapper = new LambdaQueryWrapper<>();
			lambdaQueryWrapper.eq(HsmwDriverNews::getUserId, hsmwUser.getId());
			lambdaQueryWrapper.orderByDesc(HsmwDriverNews::getCreateTime);
			List<HsmwDriverNews> news = hsmwDriverNewsService.list(lambdaQueryWrapper);
			result.put("msgList", news);
			//查询 方量统计
			return new DataResponse(result);
		} catch (Exception e) {
			e.printStackTrace();
			return new DataResponse(CommonConstants.ResponseStatus.FAIL, "获取订单列表失败，请联系管理员！");
		}
	}


*
	 * 查询司机端的我的订单列表的信息
	 *
	 * @param
	 * @return


	@ApiOperation(value = "查询当前司机下面的所有的订单", notes = "查询工长端的订单列表的信息", produces = "application/json")
	@PostMapping("/getOrderStatistics")
	public DataResponse getOrderInfoByStatus(@RequestBody OrderQueryParam status) {
		if (StringUtils.isBlank(status.getStatus())) {
			return new DataResponse("您输入的订单状态为空，请重新输入！");
		}
		try {
			LoginUser hsmwUser = currentHsmwUserUtils.getCurrentUserInfo();
			//获取工长所在项目的项目名称和项目id。
			HashMap result = new HashMap();
			HashMap param = new HashMap();
			LambdaQueryWrapper<HsmwOrderVehicleRelation> lambdaQueryWrapper = new LambdaQueryWrapper();
			List<String> statusParam = new ArrayList<>();
			if (!OrderStatusEnum.ALL.getValue().equals(status.getStatus())) {
				param.put("status", status.getStatus());
			}
			param.put("userId", hsmwUser.getId());
			List<DriverOrderInfoVO> orderList = hsmwOrderVehicleRelationService.getOrderListByParam(param);
			result.put("orderList", orderList);
			//查询 方量统计
			return new DataResponse(result);
		} catch (Exception e) {
			e.printStackTrace();
			return new DataResponse(CommonConstants.ResponseStatus.FAIL, "获取订单列表失败，请联系管理员！");
		}
	}

*
	 * 根据订单ID查询订单详情
	 *
	 * @param
	 * @return


	@ApiOperation(value = "根据订单ID查询订单详情", notes = "根据订单ID查询订单详情", produces = "application/json")
	@PostMapping("/orderInfo")
	public DataResponse getOrderDetail(@RequestBody OrderQueryParam orderQueryParam) {
		if (StringUtils.isBlank(orderQueryParam.getOrderId())) {
			return new DataResponse(CommonConstants.ResponseStatus.VALIDATE_FAILED, "您输入的订单id为空！");
		}
		try {
			LoginUser hsmwUser = currentHsmwUserUtils.getCurrentUserInfo();
			LambdaQueryWrapper<HsmwUserDriver> driverLambdaQueryWrapper = new LambdaQueryWrapper<>();
			driverLambdaQueryWrapper.eq(HsmwUserDriver::getUserId, hsmwUser.getId());
			HsmwUserDriver driver = hsmwUserDriverService.getOne(driverLambdaQueryWrapper);

			HashMap result = new HashMap();
			HsmwOrder order = hsmwOrderService.getById(orderQueryParam.getOrderId());

			LambdaQueryWrapper<HsmwOrderVehicleRelation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
			lambdaQueryWrapper.eq(HsmwOrderVehicleRelation::getOrderId, orderQueryParam.getOrderId());
			lambdaQueryWrapper.eq(HsmwOrderVehicleRelation::getVehicleId, driver.getVehicleId());
			lambdaQueryWrapper.orderByDesc(HsmwOrderVehicleRelation::getCreateTime);
			//lambdaQueryWrapper.eq(HsmwOrderVehicleRelation::getDriverId,driver.getId());
			List<HsmwOrderVehicleRelation> orderVehicleRelations = hsmwOrderVehicleRelationService.list(lambdaQueryWrapper);
			HsmwOrderVehicleRelation orderVehicleRelation = orderVehicleRelations.get(0);
			OrderDetailInnfoVO vo = new OrderDetailInnfoVO();
			if (StringUtils.isNotNull(orderVehicleRelation)) {
				vo.setVehicleModel(orderVehicleRelation.getVehicleModel());
				vo.setVehicleType(orderVehicleRelation.getVehicleType());
				vo.setDriverVolume(orderVehicleRelation.getDriverVolume());
				vo.setRealVolume(orderVehicleRelation.getRealVolume());
				vo.setClockInTime(orderVehicleRelation.getClockInTime());
				DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
				vo.setEndTime(orderVehicleRelation.getEndTime());
				vo.setOrderStatus(orderVehicleRelation.getOrderStatus());
			} else {
				vo.setVehicleModel("象泵");
				vo.setVehicleType("33");
			}
			List<HsmwOrderForceManRelation> forceManRelations =
					hsmwOrderForceManRelationService.list(new LambdaQueryWrapper<HsmwOrderForceManRelation>().eq(HsmwOrderForceManRelation::getOrderId, orderQueryParam.getOrderId()));
			result.put("detailInfo", vo);
			result.put("orderInfo", order);
			result.put("forceManRelations", forceManRelations);
			if (StringUtils.isBlank(order.getItemId())) {
				return new DataResponse(CommonConstants.ResponseStatus.VALIDATE_FAILED, "该订单对应的项目信息ID为空，请联系管理员！");
			}
			//获取项目相关的信息
			HsmwItem item = hsmwItemService.getHsmwItemById(order.getItemId());
			result.put("itemInfo", item);
			return new DataResponse(result);
		} catch (Exception e) {
			e.printStackTrace();
			return new DataResponse(CommonConstants.ResponseStatus.FAIL, "获取订单详情失败，请联系管理员！");
		}
	}


*
	 * 修改司机工作状态
	 *
	 * @param
	 * @return


	@ApiOperation(value = "修改司机工作状态", notes = "修改司机工作状态", produces = "application/json")
	@PostMapping("/updateWordStatus")
	public DataResponse updateWordStatus(@RequestBody OrderQueryParam orderQueryParam) {
		try {
			if (StringUtils.isBlank(orderQueryParam.getWorkStatus())) {
				return new DataResponse(CommonConstants.ResponseStatus.VALIDATE_FAILED, "您输入的工作状态为空，请重新输入！");
			}
			LoginUser hsmwUser = currentHsmwUserUtils.getCurrentUserInfo();
			if(CommonConstants.DRIVER_ACCEPT_ORDER.equals(orderQueryParam.getWorkStatus())){
				LambdaQueryWrapper<HsmwAudit> lambdaQueryWrapper = new LambdaQueryWrapper<>();
				lambdaQueryWrapper.eq(HsmwAudit::getUserId, hsmwUser.getId());
				List<HsmwAudit> hsmwAuditList = hsmwAuditService.list(lambdaQueryWrapper);
				LambdaQueryWrapper<HsmwUserDriver> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
				lambdaQueryWrapper1.eq(HsmwUserDriver::getUserId,hsmwUser.getId());
				HsmwUserDriver driver = hsmwUserDriverService.getOne(lambdaQueryWrapper1);
				if (StringUtils.isListNull(hsmwAuditList) ) {
					if( StringUtils.isNull(driver)){
						return new DataResponse(CommonConstants.ResponseStatus.VALIDATE_FAILED, "您还未认证信息，不能修改为接单中！");
					}
				}else{
					HsmwAudit audit = hsmwAuditList.get(0);
					if (StringUtils.isBlank(audit.getAuditStatus()) || !CommonConstants.AUDIT_COMPLETE.equals(audit.getAuditStatus())) {
						return new DataResponse(CommonConstants.ResponseStatus.VALIDATE_FAILED, "您的认证还未通过，不能修改为接单中！");
					}
				}
			}
			LambdaQueryWrapper<HsmwUserDriver> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
			lambdaQueryWrapper1.eq(HsmwUserDriver::getUserId, hsmwUser.getId());
			HsmwUserDriver hsmwUserDriver = hsmwUserDriverService.getOne(lambdaQueryWrapper1);
			if (StringUtils.isNull(hsmwUserDriver)){
				return new DataResponse(CommonConstants.ResponseStatus.VALIDATE_FAILED, "您的认证还未通过，不能修改为接单中！");
			}
			//查询司机的状态 是 接单中 还是 休息中
			hsmwUserDriver.setWorkStatus(orderQueryParam.getWorkStatus());
			hsmwUserDriverService.saveOrUpdate(hsmwUserDriver);
			return new DataResponse();
		} catch (Exception e) {
			e.printStackTrace();
			return new DataResponse(CommonConstants.ResponseStatus.FAIL, "修改司机工作状态，请联系管理员！");
		}
	}


*
	 * 司机端获取待接单的订单列表
	 *
	 * @param
	 * @return


	@ApiOperation(value = "司机端获取待接单的订单列表", notes = "司机端获取待接单的订单列表", produces = "application/json")
	@PostMapping("/myTotalInfo")
	public DataResponse myTotalInfo() {
		try {
			HashMap result = new HashMap();

//            List<HsmwOrder>

			return new DataResponse(result);
		} catch (Exception e) {
			e.printStackTrace();
			return new DataResponse(CommonConstants.ResponseStatus.FAIL, "获取订单详情失败，请联系管理员！");
		}
	}


*
	 * 司机查看我的业绩
	 *
	 * @param
	 * @return


	@ApiOperation(value = "司机查看我的业绩", notes = "司机查看我的业绩", produces = "application/json")
	@PostMapping("/getOrderInfoCount")
	public DataResponse getOrderInfoCount(@RequestBody OrderQueryVO orderQueryVO) {
		if (StringUtils.isBlank(orderQueryVO.getStartDate())) {
			return new DataResponse("您输入的起始日期为空，请重新输入！");
		}
		if (StringUtils.isBlank(orderQueryVO.getEndDate())) {
			return new DataResponse("您输入的终止日期为空，请重新输入！");


		}
		try {
			LoginUser hsmwUser = currentHsmwUserUtils.getCurrentUserInfo();
			//获取工长所在项目的项目名称和项目id。
			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			Date startDate = format.parse(orderQueryVO.getStartDate());
			Date endDate = format.parse(orderQueryVO.getEndDate());
			HashMap param = new HashMap();
			param.put("startDate", startDate);
			param.put("endDate", endDate);
			param.put("userId", hsmwUser.getId());
			List<DriverOrderResultVO> vehicleRelationList = hsmwOrderVehicleRelationService.getMyOrderInfoCount(param);
			HashMap result = new HashMap();
			int orderCount = 0;
			double volumeCount = 0.00;
			if (StringUtils.isListNotNull(vehicleRelationList)) {
				orderCount = vehicleRelationList.size();
				for (DriverOrderResultVO vo : vehicleRelationList) {
					if (StringUtils.isNotBlank(vo.getCompleteVolume())) {
						volumeCount += Double.valueOf(vo.getCompleteVolume());
					}
				}
				result.put("orderList", vehicleRelationList);
			} else {
				result.put("orderList", new ArrayList<>());
			}
			result.put("orderCount", orderCount);
			result.put("volumeCount", volumeCount + "");
			//查询 方量统计
			return new DataResponse(result);
		} catch (Exception e) {
			e.printStackTrace();
			return new DataResponse(CommonConstants.ResponseStatus.FAIL, "获取我的业绩失败，请联系管理员！");
		}
	}


*
	 * 司机查看我的认证
	 *
	 * @param
	 * @return


	@ApiOperation(value = "司机查看我的认证", notes = "司机查看我的认证", produces = "application/json")
	@PostMapping("/myAuditInfo")
	public DataResponse myAuditInfo() {
		try {
			LoginUser hsmwUser = currentHsmwUserUtils.getCurrentUserInfo();
			HashMap result = new HashMap();

			LambdaQueryWrapper<HsmwAudit> lambdaQueryWrapper = new LambdaQueryWrapper<>();
			lambdaQueryWrapper.eq(HsmwAudit::getUserId, hsmwUser.getId());

			List<HsmwAudit> hsmwAuditList = hsmwAuditService.list(lambdaQueryWrapper);

			if (StringUtils.isListNull(hsmwAuditList)) {
				result.put("auditInfo", new HsmwAudit());
			} else {
				HsmwAudit hsmwAudit = hsmwAuditList.get(0);
				result.put("auditInfo", hsmwAudit);
			}
			//查询 方量统计
			return new DataResponse(result);
		} catch (Exception e) {
			e.printStackTrace();
			return new DataResponse(CommonConstants.ResponseStatus.FAIL, "获取我的认证失败，请联系管理员！");
		}
	}


*
	 * 司机进入我的所需信息
	 *
	 * @param
	 * @return


	@ApiOperation(value = "司机进入我的所需信息", notes = "司机进入我的所需信息", produces = "application/json")
	@PostMapping("/aboutMe")
	public DataResponse aboutMe() {
		try {
			LoginUser hsmwUser = currentHsmwUserUtils.getCurrentUserInfo();
			HashMap result = new HashMap();
			LambdaQueryWrapper<HsmwAudit> lambdaQueryWrapper = new LambdaQueryWrapper<>();
			lambdaQueryWrapper.eq(HsmwAudit::getUserId, hsmwUser.getId());
			List<HsmwAudit> hsmwAuditList = hsmwAuditService.list(lambdaQueryWrapper);
			LambdaQueryWrapper<HsmwUserDriver> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
			lambdaQueryWrapper1.eq(HsmwUserDriver::getUserId,hsmwUser.getId());
			HsmwUserDriver driver = hsmwUserDriverService.getOne(lambdaQueryWrapper1);
			String auditStatus = "";
			if (StringUtils.isListNull(hsmwAuditList)) {
				if (StringUtils.isNull(driver)){
					auditStatus = "未认证";
				}else {
					auditStatus = "已认证";
				}
			} else {
				HsmwAudit hsmwAudit = hsmwAuditList.get(0);
				if (CommonConstants.AUDIT_ING.equals(hsmwAudit.getAuditStatus())) {
					auditStatus = "认证中";
				}
				if (CommonConstants.AUDIT_COMPLETE.equals(hsmwAudit.getAuditStatus())) {
					auditStatus = "已认证";
				}
				if (CommonConstants.AUDIT_FAILURE.equals(hsmwAudit.getAuditStatus())) {
					auditStatus = "认证失败";
				}
				if (StringUtils.isBlank(hsmwAudit.getAuditStatus())) {
					auditStatus = "未认证";
				}
			}

			result.put("userName", StringUtils.isBlank(hsmwUser.getName()) ?hsmwUser.getUsername():hsmwUser.getName());

			result.put("auditStatus", auditStatus);
			result.put("aboutMe", CommonConstants.HTN_BINNER);

			//查询 方量统计
			return new DataResponse(result);
		} catch (Exception e) {
			e.printStackTrace();
			return new DataResponse(CommonConstants.ResponseStatus.FAIL, "获取我的认证失败，请联系管理员！");
		}
	}

*
	 * 取消订单
	 *
	 * @param
	 * @return


	@ApiOperation(value = "取消订单", notes = "取消订单", produces = "application/json")
	@PostMapping("/cancelOrder")
	public DataResponse cancelOrder(@RequestBody OrderQueryParam orderQueryParam) {
		if (StringUtils.isBlank(orderQueryParam.getOrderId())) {
			return new DataResponse(CommonConstants.ResponseStatus.VALIDATE_FAILED, "您输入的订单id为空！");
		}
		try {
			return hsmwUserDriverService.cancelOrder(orderQueryParam);
		} catch (Exception e) {
			e.printStackTrace();
			return new DataResponse(CommonConstants.ResponseStatus.FAIL, "取消订单失败，请联系管理员！");
		}
	}


*
	 * 完成订单
	 *
	 * @param
	 * @return


	@ApiOperation(value = "订单相关的操作  完成订单 status = 5  driverVolume=司机的方量; 已到达现场 status = 4;  ", notes = "完成订单", produces = "application/json")
	@PostMapping("/updateOrderInfo")
	public DataResponse updateOrderInfo(@RequestBody OrderQueryParam orderQueryParam) {
		if (StringUtils.isBlank(orderQueryParam.getOrderId())) {
			return new DataResponse(CommonConstants.ResponseStatus.VALIDATE_FAILED, "您输入的订单id为空！");
		}
		if (StringUtils.isBlank(orderQueryParam.getStatus())) {
			return new DataResponse(CommonConstants.ResponseStatus.VALIDATE_FAILED, "您输入的订单状态为空！");
		}
		try {
			return hsmwUserDriverService.updateOrderInfo(orderQueryParam);
		} catch (Exception e) {
			e.printStackTrace();
			return new DataResponse(CommonConstants.ResponseStatus.FAIL, "更新订单信息失败，请联系管理员！");
		}
	}

*
	 * 司机端获取待接单的订单列表
	 *
	 * @param
	 * @return


	@ApiOperation(value = "司机端获取待接单的订单列表", notes = "司机端获取待接单的订单列表", produces = "application/json")
	@PostMapping("/taskingOrderList")
	public DataResponse taskingOrderList() {
		try {
			LoginUser hsmwUser = currentHsmwUserUtils.getCurrentUserInfo();

			HashMap result = new HashMap();
			HashMap param = new HashMap();
			param.put("userId", hsmwUser.getId());
			List<TaskingOrderVO> taskingOrderVOList = hsmwUserDriverService.taskingOrderList(param);


			result.put("orderList", taskingOrderVOList);
			return new DataResponse(result);
		} catch (Exception e) {
			e.printStackTrace();
			return new DataResponse(CommonConstants.ResponseStatus.FAIL, "获取待接单订单信息失败，请联系管理员！");
		}
	}


*
	 * 抢单接口
	 *
	 * @param
	 * @return


	@ApiOperation(value = "抢单接口  ", notes = "抢单接口", produces = "application/json")
	@PostMapping("/grabbingOrders")
	public DataResponse grabbingOrders(@RequestBody OrderQueryParam orderQueryParam) {
		if (StringUtils.isBlank(orderQueryParam.getOrderId())) {
			return new DataResponse(CommonConstants.ResponseStatus.VALIDATE_FAILED, "您输入的订单id为空！");
		}
		if (StringUtils.isBlank(orderQueryParam.getVehicleRelationId())) {
			return new DataResponse(CommonConstants.ResponseStatus.VALIDATE_FAILED, "您输入的司机订单关系id为空！");
		}
		if (StringUtils.isNull(orderQueryParam.getVersion())) {
			return new DataResponse(CommonConstants.ResponseStatus.VALIDATE_FAILED, "您输入的司机订单关系id记录版本号为空！");
		}
		try {
			LoginUser hsmwUser = currentHsmwUserUtils.getCurrentUserInfo();
			LambdaQueryWrapper<HsmwUserDriver> lambdaQueryWrapper = new LambdaQueryWrapper<>();
			lambdaQueryWrapper.eq(HsmwUserDriver::getUserId, hsmwUser.getId());
			List<HsmwUserDriver> drivers = hsmwUserDriverService.list(lambdaQueryWrapper);
			if (com.htn.common.core.utils.StringUtils.isListNull(drivers)) {
				return new DataResponse(CommonConstants.ResponseStatus.VALIDATE_FAILED, "当前的司机信息不存在！");
			}
			HsmwUserDriver driver = drivers.get(0);
			//抢单之前先检查该司机名下有进行中的订单
			LambdaQueryWrapper<HsmwOrderVehicleRelation> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
			lambdaQueryWrapper1.eq(HsmwOrderVehicleRelation::getVehicleId, driver.getVehicleId());
			List<String> statusParam = new ArrayList<>();
			statusParam.add(OrderStatusEnum.RECEIVED.getValue());
			statusParam.add(OrderStatusEnum.GOING.getValue());
			lambdaQueryWrapper1.in(HsmwOrderVehicleRelation::getOrderStatus, statusParam);
			List<HsmwOrderVehicleRelation> vehicleRelationList = hsmwOrderVehicleRelationService.list(lambdaQueryWrapper1);
			if (StringUtils.isListNotNull(vehicleRelationList) && vehicleRelationList.size() > 0) {
				return new DataResponse(CommonConstants.ResponseStatus.FAIL, "您所绑定的车辆有正在进行中订单，不能再次抢单！");
			}
			return hsmwUserDriverService.grabbingOrders(orderQueryParam);
		} catch (Exception e) {
			e.printStackTrace();
			return new DataResponse(CommonConstants.ResponseStatus.FAIL, "抢单异常，请联系管理员！");
		}
	}


*
	 * 获取认证所需要的字典
	 *
	 * @param
	 * @return


	@ApiOperation(value = "获取认证  所需要的字典", notes = "获取认证 所需要的字典", produces = "application/json")
	@PostMapping("/getDictInfo")
	public DataResponse getOrderCreateInfo() {
		try {
			HashMap result = hsmwOrderService.getOrderDictInfo();
			return new DataResponse(result);
		}catch (Exception e){
			e.printStackTrace();
			return new DataResponse(CommonConstants.ResponseStatus.FAIL,"获取订单创建所需要的字典和工长列表失败，请联系管理员！");
		}
	}


}
*/
